home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / viewkit / xcontact / lib / OkComponent.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  1.8 KB  |  56 lines

  1. /*
  2.  * Copyright (C) 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. //////////////////////////////////////////////////////////////////////////////
  18. // OkComponent.h - 
  19. //////////////////////////////////////////////////////////////////////////////
  20. #ifndef OKCOMPONENT_H
  21. #define OKCOMPONENT_H
  22.  
  23. #include <Vk/VkComponent.h>
  24.  
  25. #include "OkCompoundString.h"
  26.  
  27. #define cat(a,b)    a ## b
  28.  
  29. #define CALLBACKSTUB(className,name)\
  30.   static void cat(name,CB)( Widget, XtPointer ptr, XtPointer cbInfo )\
  31.   { className *obj = (className *) ptr; obj->_cbInfo = cbInfo; obj->name(); }
  32.   
  33. #define CALLBACK(className,name) &className::cat(name,CB)
  34.  
  35.  
  36. class OkComponent : public VkComponent {
  37.  
  38.  protected:
  39.   XtPointer     _cbInfo;
  40.  
  41.  public:
  42.   OkComponent( const char* name ) : VkComponent( name ) {}
  43.   virtual ~OkComponent() {}
  44.   virtual const char* className() { return "OkComponent"; }
  45.  
  46.   // Conveniences:
  47.  
  48.   void addCallback( const String name, XtCallbackProc func )
  49.     { XtAddCallback( _baseWidget, name, func, XtPointer( this ) ); }
  50.   void removeCallback( const String name, XtCallbackProc func )
  51.     { XtRemoveCallback( _baseWidget, name, func, XtPointer( this ) ); }
  52.  
  53. };
  54.  
  55. #endif
  56.